package cn.iocoder.yudao.module.ad.order.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ad.order.service.AppAdPlanOrderService;
import cn.iocoder.yudao.module.ad.order.vo.AppAdPlanOrderVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

@Tag(name = "用户 App - 广告投放订单")
@RestController
@RequestMapping("/ad/plan-order")
@Validated
public class AppAdPlanOrderController {
    @Resource
    private AppAdPlanOrderService appAdPlanOrderService;

    @Operation(summary = "分页")
    @GetMapping("/page")
    public CommonResult<PageResult<AppAdPlanOrderVO>> getPage(@Valid PageParam param) {
        return success(appAdPlanOrderService.getPage(param.getPageNo(), param.getPageSize(), getLoginUserId()));
    }

}